package com.hbnu.test.www;

import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        //创建输入对象
        Scanner scanner = new Scanner(System.in);
        //定义数组
        int[] arr = new int[5];
        int i = 0;
        for (i = 0; i < arr.length; i++) {
            arr[i] = scanner.nextInt();
        }
        for (i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        //对数组中元素排序
        int j = 0;
        int temp = 0;
        for (i = 0; i < arr.length - 1; i++) {
            for (j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
        //输出排序后元素
        for (i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
